package com.woniuxy.demo.contorller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author 佘赛飞
 * @create 2021 -10 -09 5:43 PM
 */
@RestController
@Controller
public class MyContorller {
    @PostMapping("/upload")
    public String upload(MultipartFile img) throws IOException {
        String originalFilename = img.getOriginalFilename();
        File file = new File("/Users/shesaifei/IdeaProjects/images", originalFilename);
        img.transferTo(file);
        return "ok";
    }
}
